Use Windows.pkg
Use DFClient.pkg
Use cPatientDataDictionary.dd
Use DFEntry.pkg
Use cDbTextEdit.pkg
Use dfTabDlg.pkg
Use dfallent.pkg
Use dfLine.pkg

Object oInsuranceCodeTable is a DescriptionValidationTable
    Procedure Fill_List
        Forward Send Fill_List
        Send Add_Table_Value "BCBS" "Blue Cross/Blue Shield"
        Send Add_Table_Value "CIGNA" "Cigna Health Insurance"
        Send Add_Table_Value "NYLC" "Nylcare"
        Send Add_Table_Value "PHCS" "Private Healthcare Systems"
        Send Add_Table_Value "MDCD" "Medicaid"
        Send Add_Table_Value "MDCR" "Medicare"
        Send Add_Table_Value "OTHER" "Other Insurance"
        Send Add_Table_Value "NONE" "No Insurance"
    End_Procedure
End_Object

Register_Function ValidatePatient# Integer iColumn Integer iValue Returns Boolean
Register_Function ValidateLastName Integer iColumn String sValue Returns Boolean
Register_Function ValidateFirstName Integer iColumn String sValue Returns Boolean
Register_Function ValidateInsuranceCode Integer iColumn String sValue Returns Boolean

Deferred_View Activate_oPatientSetup for ;
Object oPatientSetup is a dbView
    Set Border_Style to Border_Thick
    Set Size to 180 347
    Set Location to 4 4
    Set Label to "Patient Setup"
    Set Icon to "doctor_plus.ico"
    
    Object oPATIENT_DD is a cPatientDataDictionary
        Set Field_Value_Table Field PATIENT.INSURANCE_CODE to oInsuranceCodeTable
        Set Field_Validate_msg Field PATIENT.INSURANCE_CODE to get_ValidateInsuranceCode
        Set Field_Validate_msg Field PATIENT.FIRST_NAME to get_ValidateFirstName
        Set Field_Validate_msg Field PATIENT.LAST_NAME to get_ValidateLastName
        Set Field_Validate_msg Field PATIENT.PATIENT# to get_ValidatePatient#
        Set Field_Option Field PATIENT.PATIENT# DD_AUTOFIND to True
        
        Function ValidateLastName Integer iColumn String sValue Returns Boolean
            Boolean bFail
            
            Move False to bFail
            If (sValue = "") Begin
                Move True to bFail
                Send Info_Box "Please enter a last name." (psMboxCaption(Self))
            End
            Function_Return bFail
        End_Function
    
        Function ValidateFirstName Integer iColumn String sValue Returns Boolean
            Boolean bFail
            
            Move False to bFail
            If (sValue = "") Begin
                Move True to bFail
                Send Info_Box "Please enter a first name." (psMboxCaption(Self))
            End
            Function_Return bFail
        End_Function
    
        Function ValidatePatient# Integer iColumn Integer iSSN Returns Boolean
            Boolean bFail
            
            Move False to bFail
            If (iSSN = 0) Begin
                Move True to bFail
                Send Info_Box "Please enter a patient number." (psMboxCaption(Self))
            End
            Function_Return bFail
        End_Function
    
        Function ValidateInsuranceCode Integer iColumn String sValue Returns Boolean
            Boolean bFail
            
            Get Validate_Value of oInsuranceCodeTable sValue to bFail
            If (bFail) Send Info_Box ("Invalid insurance code:" * sValue * "\n\nPlease select a valid insurance code from the prompt menu.") (psMboxCaption(Self))
            Function_Return bFail
        End_Function
        
    End_Object

    Set Main_DD to oPATIENT_DD
    Set Server to oPATIENT_DD

    Object oPatientSetupTabDialog is a dbTabDialog
        Set Size to 155 329
        Set Location to 12 9
        Set peAnchors to anAll
    
        Set Rotate_Mode to RM_Rotate

        Object oBasicInfoTab is a dbTabPage
            Set Label to "&Main"

            Object oPATIENT_PATIENT_ is a dbForm
                Entry_Item PATIENT.PATIENT#
                Set Location to 9 43
                Set Size to 13 66
                Set Label to "Patient #"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oPATIENT_DOB is a dbForm
                Entry_Item PATIENT.DOB
                Set Location to 9 134
                Set Size to 13 66
                Set Label to "DOB"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oPATIENT_BALANCE_DUE is a dbForm
                Entry_Item PATIENT.BALANCE_DUE
                Set Location to 9 253
                Set Size to 13 59
                Set Label to "Balance Due"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oPATIENT_LAST_NAME is a dbForm
                Entry_Item PATIENT.LAST_NAME
                Set Location to 30 43
                Set Size to 13 71
                Set Label to "Last Name"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oPATIENT_MIDDLE_INIT is a dbForm
                Entry_Item PATIENT.MIDDLE_INIT
                Set Location to 30 142
                Set Size to 13 13
                Set Label to "Middle"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oPATIENT_FIRST_NAME is a dbForm
                Entry_Item PATIENT.FIRST_NAME
                Set Location to 30 196
                Set Size to 13 69
                Set Label to "First Name"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oPATIENT_GENDER is a dbForm
                Entry_Item PATIENT.GENDER
                Set Location to 30 299
                Set Size to 13 13
                Set Label to "Gender"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Right
            End_Object

            Object oLineControl3 is a LineControl
                Set Size to 2 247
                Set Location to 54 38
            End_Object

            Object oPATIENT_ADDR1 is a dbForm
                Entry_Item PATIENT.ADDR1
                Set Location to 69 4
                Set Size to 13 152
                Set Label to "Address 1"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_ADDR2 is a dbForm
                Entry_Item PATIENT.ADDR2
                Set Location to 93 4
                Set Size to 13 153
                Set Label to "Address 2"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_CITY is a dbForm
                Entry_Item PATIENT.CITY
                Set Location to 117 4
                Set Size to 13 71
                Set Label to "City"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_STATE is a dbForm
                Entry_Item PATIENT.STATE
                Set Location to 117 82
                Set Size to 13 20
                Set Label to "State"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_ZIP is a dbForm
                Entry_Item PATIENT.ZIP
                Set Location to 117 108
                Set Size to 13 49
                Set Label to "Zip"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oLineControl2 is a LineControl
                Set Size to 58 5
                Set Location to 65 168
                Set Horizontal_State to False
            End_Object
            Object oPATIENT_EMPLOYER is a dbForm
                Entry_Item PATIENT.EMPLOYER
                Set Location to 69 179
                Set Size to 13 137
                Set Label to "Employer"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
            Object oPATIENT_JOB_TITLE is a dbForm
                Entry_Item PATIENT.JOB_TITLE
                Set Location to 93 179
                Set Size to 13 137
                Set Label to "Job Title"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_HOME_PHONE is a dbForm
                Entry_Item PATIENT.HOME_PHONE
                Set Location to 117 179
                Set Size to 13 66
                Set Label to "Home Phone"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_DAYTIME_PHONE is a dbForm
                Entry_Item PATIENT.DAYTIME_PHONE
                Set Location to 117 251
                Set Size to 13 66
                Set Label to "Daytime Phone"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
        End_Object

        Object oInsuranceTab is a dbTabPage
            Set Label to "&Insurance"

            Object oPATIENT_INSURANCE_CODE is a dbForm
                Entry_Item PATIENT.INSURANCE_CODE
                Set Location to 30 27
                Set Size to 13 55
                Set Label to "Code"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
            Object oPATIENT_INSURANCE_ID_ is a dbForm
                Entry_Item PATIENT.INSURANCE_ID#
                Set Location to 30 92
                Set Size to 13 55
                Set Label to "ID"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
            Object oPATIENT_INSURANCE_PHONE is a dbForm
                Entry_Item PATIENT.INSURANCE_PHONE
                Set Location to 30 156
                Set Size to 13 54
                Set Label to "Phone"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object

            Object oPATIENT_INSURED_NAME is a dbForm
                Entry_Item PATIENT.INSURED_NAME
                Set Location to 57 27
                Set Size to 13 184
                Set Label to "Name"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
            Object oPATIENT_COPAY is a dbForm
                Entry_Item PATIENT.COPAY
                Set Location to 88 27
                Set Size to 13 42
                Set Label to "Copay"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
        End_Object

        Object oEmergencyTab is a dbTabPage
            Set Label to "Emer&gency"

            Object oPATIENT_EM_CONTACT is a dbForm
                Entry_Item PATIENT.EM_CONTACT
                Set Location to 30 27
                Set Size to 13 175
                Set Label to "Contact"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
            Object oPATIENT_EM_PHONE is a dbForm
                Entry_Item PATIENT.EM_PHONE
                Set Location to 57 27
                Set Size to 13 99
                Set Label to "Phone"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
            Object oPATIENT_EM_RELATIONSHIP is a dbForm
                Entry_Item PATIENT.EM_RELATIONSHIP
                Set Location to 88 27
                Set Size to 13 96
                Set Label to "Relationship"
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
            End_Object
        End_Object

        Object oAllergiesTab is a dbTabPage
            Set Label to "A&llergies"

            Object oPATIENT_ALLERGIES is a cDbTextEdit
                Entry_Item PATIENT.ALLERGIES
                Set Location to 5 7
                Set Size to 132 310
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
                Set peAnchors to anAll
            End_Object
        End_Object

        Object oNotesTab is a dbTabPage
            Set Label to "N&otes"

            Object oPATIENT_NOTES is a cDbTextEdit
                Entry_Item PATIENT.NOTES
                Set Location to 5 7
                Set Size to 132 310
                Set Label_Col_Offset to 0
                Set Label_Justification_Mode to JMode_Top
                Set peAnchors to anAll
            End_Object
        End_Object
        
        Procedure Switch_To_Main
            Send Request_Switch_To_Tab 0 3
        End_Procedure
        
        Procedure Switch_To_Insurance
            Send Request_Switch_To_Tab 1 3
        End_Procedure
        
        Procedure Switch_To_Emergency
            Send Request_Switch_To_Tab 2 3
        End_Procedure
        
        Procedure Switch_To_Allergies
            Send Request_Switch_To_Tab 3 3
        End_Procedure
        
        Procedure Switch_To_Notes
            Send Request_Switch_To_Tab 4 3
        End_Procedure

    End_Object
    
    On_Key Key_Alt+Key_M Send Switch_To_Main
    On_Key Key_Alt+Key_I Send Switch_To_Insurance
    On_Key Key_Alt+Key_G Send Switch_To_Emergency
    On_Key Key_Alt+Key_L Send Switch_To_Allergies
    On_Key Key_Alt+Key_O Send Switch_To_Notes

Cd_End_Object
